import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { Article } from './article.entity';
import { SpecialColumn } from 'src/special-column/entities/special-column.entity';

@Entity()
export class ArticleColumnRelated {
  // 主键 唯一且自增长
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  articleId: number;

  @Column()
  articleTitle: string;

  @Column()
  columnId: number;

  @Column()
  columnTitle: string;

  @Column({ default: 0 })
  isDeleted: number; // 是否删除，0表示未删除，1表示已删除

  @ManyToOne(() => Article, (article) => article.id, { eager: false })
  article: Article;

  @ManyToOne(() => SpecialColumn, (column) => column.id, { eager: false })
  column: SpecialColumn;
}
